<template>
  <div class="home" ref="homeRef" @touchstart="handleTouchStart" @touchend="handleTouchEnd">
    <div class="tcy">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/tcy.png" alt="">
    </div>
    <div class="tlp">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/tly.png" alt="">
    </div>
    <div class="try">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/try.png" alt="">
    </div>
    <div class="neirong">
      <div class="ft">
        <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/ft1.png" alt="">
      </div>
      <div v-show="stateMixin.index === 0" class="tc" >
        <img class="gb" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/gb.png" alt="" @click="router.push({path:'/standing'})">
        <img class="xj" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xiangji.png" alt="">
        <div class="textBox" v-html="state.text"></div>
        <img v-if="Session.get('token') !== '2'" class="shanghua" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/shanghua.png" alt="">
        <img v-else class="jxyx" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/jxyx.png" alt="" @click="goPlay">
      </div>
      <div v-show="stateMixin.index === 1" class="tc1">
        <img class="gb" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/gb.png" alt="" @click="stateMixin.index -= 1">
        <img class="xj" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xiangji.png" alt="">
        <div class="textBox" v-html="state.text1"></div>
        <img class="shanghua" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/shanghua.png" alt="">
      </div>
      <div v-show="stateMixin.index === 2" class="tc2">
        <img class="gb" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/gb.png" alt="" @click="stateMixin.index -= 1">
        <img class="xj" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xiangji.png" alt="">
        <div class="textBox" v-html="state.text2"></div>
        <img class="shanghua" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/shanghua.png" alt="">
      </div>
      <div v-show="stateMixin.index === 3" class="tc3">
        <img class="gb" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/gb.png" alt="" @click="stateMixin.index -= 1">
        <img class="xj" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xiangji.png" alt="">
        <div class="textBox" v-html="state.text22"></div>
        <img class="shanghua" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/shanghua.png" alt="">
      </div>
      <div v-show="stateMixin.index === 4" class="tc4">
        <img class="gb" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/gb.png" alt="" @click="stateMixin.index -= 1">
        <img class="xj" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xiangji.png" alt="">
        <div class="textBox" v-html="state.text3"></div>
        <img class="shanghua" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/shanghua.png" alt="">
      </div>
      <div class="xx">
        <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xx.png" alt="">
      </div>
      <div class="yf">
        <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/yf.png" alt="">
      </div>
      <div class="dlh">
        <img class="dlhd" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/dlhd.png" alt="">
        <img class="bg" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/bg.png" alt="">
        <img class="dlhs" src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/dlh.png" alt="">
      </div>
    </div>
    <div class="xft">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/ft1.png" alt="">
    </div>
    <div class="logo">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/logo.png" alt="">
    </div>
    <div class="yiduiren" >
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/yiduiren.png" alt="">
    </div>
    <div  class="tc2Dh">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/tc2dh.png" alt="">
    </div>
    <div class="nvtuo" v-show="state.sex === '0'">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/nvtuo.png" alt="">
    </div>
    <div class="tuojunn" v-show="state.sex === '1'">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/tuojunn.png" alt="">
    </div>
    <div class="bly">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/bly.png" alt="">
    </div>
    <div class="bry">
      <img src="https://vivo.zhongwangyingtong.com/vivoimage/assets/image/bry.png" alt="">
    </div>
  </div>
</template>

<script setup lang="ts">
import {onMounted, reactive, ref} from 'vue';
import {Local,Session} from '../../utils/storage'
import { homeCartoon } from './cartoon'
import { useRouter } from 'vue-router'
const router = useRouter()
const homeRef = ref();
const { handleTouchStart,handleTouchEnd,stateMixin } = homeCartoon(homeRef)
const state = reactive({
  text:'',
  text1:'',
  text2:'',
  text22:'',
  text3:'',
  text4:'',
  sex:''
})

const goPlay = () => {
  router.push({
    path:'/playIndex'
  })
}
onMounted(() => {
  if(Session.get('token') === '0'){
    state.text = Local.get('userInfo').list.content.replace(/\n/g,'<br/>').replace(/\d+/g, (match) => {
      return `<span style="color: #ad61fa">${match}</span>`; // 将数字包裹在 span 标签中
    })
    state.text1 = Local.get('userInfo').list.content_1.replace(/\n/g,'<br/>').replace(/\d+/g, (match) => {
      return `<span style="color: #ad61fa">${match}</span>`; // 将数字包裹在 span 标签中
    })
    state.text2 = Local.get('userInfo').list.content_2.replace(/\n/g,'<br/>').replace(/\d+/g, (match) => {
      return `<span style="color: #ad61fa">${match}</span>`; // 将数字包裹在 span 标签中
    })
    state.text22 = Local.get('userInfo').list.content_3.replace(/\n/g,'<br/>').replace(/\d+/g, (match) => {
      return `<span style="color: #ad61fa">${match}</span>`; // 将数字包裹在 span 标签中
    })
    state.text3 = Local.get('userInfo').list.content_boy.replace(/\n/g,'<br/>').replace(/\d+/g, (match) => {
      return `<span style="color: #ad61fa">${match}</span>`; // 将数字包裹在 span 标签中
    })
    state.text4 = Local.get('userInfo').list.poster_boy.replace(/\n/g,'<br/>').replace(/\d+/g, (match) => {
      return `<span style="color: #ad61fa">${match}</span>`; // 将数字包裹在 span 标签中
    })
  } else {
    state.text = Local.get('userInfo').list.content.replace(/\n/g,'<br/>').replace(/\d+/g, (match) => {
      return `<span style="color: #ad61fa">${match}</span>`; // 将数字包裹在 span 标签中
    })
  }
  state.text = Local.get('userInfo').list.content.replace(/\n/g,'<br/>').replace(/\d+/g, (match) => {
    return `<span style="color: #ad61fa">${match}</span>`; // 将数字包裹在 span 标签中
  })
  state.sex = Local.get('sex')
});
</script>

<style lang="scss" scoped>
.shanghua{
  transform: translate(-50%, -50%);
  position: absolute;
  left: 50%;
  bottom: -150px;
  width: 30%;
  z-index: 9999999999;
}
.userVerify{
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  .popupBox{
    box-sizing: border-box;
    padding: 30px 20px;
    width: 80%;
    height: 300px;
    position: relative;
    background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/xaunzeshenfen.png");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;

    .dyBox{
      position: absolute;
      bottom: 0;
      width: 100%;
    }
    .xiangji{
      position: absolute;
      right: -30px;
      top: 50px;
      width: 80px;
    }
    .yfBox{
      position: absolute;
      left: -20px;
      bottom: -40px;
      width: 60px;
    }
    .schb{
      width: 80%;
      margin: 0 auto;
    }
    .selectBox{
      width: 80%;
      height: 50px;
      margin: 0 auto;
      position: relative;
      //overflow: hidden;
      .selectBoxAc{
        position: absolute;
        top: -5px;
        left: 0;
      }
    }
    .selectBox:nth-child(1){
      margin-top:20px;
    }
    .nameBox,.sjBox{
      //position: absolute;
      margin-top: 8px;
      width: 80%;
      height: 40px;
      z-index: 99;
      background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image/xmsr.png");
      background-size: 100% 100%;
      background-position: center;
      background-repeat: no-repeat;
      display: flex;
      align-items: center;
      :deep(.el-input__wrapper){
        border-radius: 50px !important;
        border: 1px solid black;
      }
      :deep(.el-input__inner){
        font-size: 18px;
        //text-align: center;
      }
      :deep(.el-input){
        width: 100%;
        height: 40px;
        border-radius: 40px !important;

      }
    }
  }
}
.yiduiren{
  position: absolute;
  width: 75%;
  bottom: -150px;
  opacity: 0;
  right: 0;
  z-index: 2;
}
.tc2Dh{
  opacity: 0;
}
.nvtuo{
  width: 50%;
  z-index: 2;
  position: absolute;
  bottom: -500px;
}
.tuojunn{
  width: 50%;
  z-index: 2;
  position: absolute;
  bottom: -435px;
  right: -20px;
}
.tc{
  position: absolute;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 355px;
  left: 50%;
  top: 40%;
  z-index: 999999999999;
  background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/tc.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  .gb{
    width: 40px;
    position: absolute;
    right: -15px;
    top: -15px;
  }
  .xj{
    width: 60px;
    position: absolute;
    right: -25px;
    top: 25%;
  }
  .textBox{
    position: absolute;
    z-index: 2;
    width: 90%;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 57%;
    color: #1a1a1a;
    line-height: 30px;
  }

  .jxyx{
    transform: translate(-50%, -50%);
    position: absolute;
    left: 50%;
    bottom: -80px;
    width: 70%;
    z-index: 999999999;
  }

}

.tc1{
  position: absolute;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 350px;
  left: 50%;
  top: 40%;
  z-index: 9999999;
  background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/tc1.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  .gb{
    width: 40px;
    position: absolute;
    right: -15px;
    top: -15px;
  }
  .xj{
    width: 60px;
    position: absolute;
    right: -25px;
    top: 25%;
  }
  .textBox{
    position: absolute;
    z-index: 2;
    width: 90%;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 61%;
    color: #1a1a1a;
    line-height: 30px;
    font-size: 14px;
  }
  //.shanghua{
  //  transform: translate(-50%, -50%);
  //  z-index: 50;
  //  position: absolute;
  //  left: 50%;
  //  bottom: -150px;
  //
  //  width: 30%;
  //}
}

.tc2{
  position: absolute;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 350px;
  left: 50%;
  top: 40%;
  z-index: 1;
  background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/tc2.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  .gb{
    width: 40px;
    position: absolute;
    right: -15px;
    top: -15px;
  }
  .xj{
    width: 60px;
    position: absolute;
    right: -25px;
    top: 25%;
  }
  .textBox{
    position: absolute;
    z-index: 2;
    width: 90%;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 60%;
    color: #1a1a1a;
    line-height: 26px;
    font-size: 14px;
  }
  .shanghua{
    transform: translate(-50%, -50%);
    z-index: 20;
    position: absolute;
    left: 50%;
    bottom: -150px;
    width: 30%;
  }
}

.tc3{
  position: absolute;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 350px;
  left: 50%;
  top: 40%;
  z-index: 1;
  background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/tc1.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  .gb{
    width: 40px;
    position: absolute;
    right: -15px;
    top: -15px;
  }
  .xj{
    width: 60px;
    position: absolute;
    right: -25px;
    top: 25%;
  }
  .textBox{
    position: absolute;
    z-index: 2;
    width: 90%;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 61%;
    color: #1a1a1a;
    line-height: 30px;
    font-size: 14px;
  }
  .shanghua{
    transform: translate(-50%, -50%);
    z-index: 20;
    position: absolute;
    left: 50%;
    bottom: -150px;
    width: 30%;
  }
}
.tc4{
  position: absolute;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 364px;
  left: 50%;
  top: 40%;
  z-index: 1;
  background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image2/tc2.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  .gb{
    width: 40px;
    position: absolute;
    right: -15px;
    top: -15px;
  }
  .xj{
    width: 60px;
    position: absolute;
    right: -25px;
    top: 25%;
  }
  .textBox{
    position: absolute;
    z-index: 2;
    width: 90%;
    transform: translate(-50%, -50%);
    left: 50%;
    top: 52%;
    color: #1a1a1a;
    line-height: 27px;
    font-size: 14px;
  }
  .shanghua{
    transform: translate(-50%, -50%);
    z-index: 20;
    position: absolute;
    left: 50%;
    bottom: -150px;
    width: 30%;
  }
}

img {
  width: 100%;
}

.text{
  width: 100%;
  position: absolute;
  top: 40%;
  font-size: 18px;
  color: white;
  .text1,.text2,.text3,.text4{
    opacity: 0;
    //font-family: vivoSxgn;
  }
}
.haibao{
  position: absolute;
  display: none;
  width: 100%;
  bottom: 0;
  .homeImg{
    position: absolute;
    width: 100%;
    left: 0;
    bottom:-392px;
    display: none;
  }
  .xfy{
    width: 80%;
    position: absolute;
    left: 0;
    bottom: -150px;
  }
}
.xft{
  width: 70%;
  position: absolute;
  z-index: 9999;
  left: 35%;
  top: -130px;
}
.logo{
  position: absolute;
  width: 44%;
  display: flex;
  top: 30px;
  justify-content: center;
  opacity:0;
  img{
    width: 70%;
  }
}
.btn{
  position: absolute;
  width: 100%;
  display: flex;
  bottom: 70px;
  justify-content: center;
  opacity:0;
  z-index: 99;
  img{
    width: 70%;
  }
}
.home {
  width: 100%;
  height: 100%;
  background: url("https://vivo.zhongwangyingtong.com/vivoimage/assets/image/bc.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
  .tlp {
    position: absolute;
    width: 80%;
    top: 0;
    left: 0;
  }

  .tcy {
    position: absolute;
    width: 65%;
    top: 15px;
    left: 28%;
  }

  .try {
    position: absolute;
    width: 50%;
    top: 0;
    right: 0;
    z-index: 1;
  }

  .ft {
    position: absolute;
    width: 80%;
    left: -40px;
  }

  .xx {
    width: 50%;
    position: absolute;
    top: 13%;
    left: 20%;
  }

  .yf {
    width: 50px;
    position: absolute;
    top: -100px;
    left: 5%;
    z-index: 2;
  }

  .hlh{
    width: 12%;
    position: absolute;
    top: -100px;
    right: 20%;
  }

  .llh{
    width: 17%;
    position: absolute;
    top: -100px;
    right: 0;
  }

  .dlh{
    position: absolute;
    width: 150px;
    height: 150px;
    top: -80px;
    left: 0%;
    z-index: 5;
    .bg{
      width: 120%;
      display: none;
      position: absolute;
      top: -155px;
      left: 36px;
    }
    .dlhd{
      position: absolute;
      left: 15px;
      top: -10px;
      transform: rotate(15deg);
      z-index: 6;
    }
    .lcd{
      //z-index: 9;
      display: none;
      position: absolute;
      left: 100px;
      top: -80px;
    }
  }

  .hzl{
    //width: 200px;
    display: none;
    .yb1{
      position: absolute;
      width: 10px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
    .yb2{
      position: absolute;
      width: 15px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
    .yb3{
      position: absolute;
      width: 15px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
    .hg{
      position: absolute;
      width: 15px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
    .hz{
      position: absolute;
      width: 15px;
      bottom: 190px;
      left: 26%;
      z-index: 10;
    }
  }

  .cd{
    //position: absolute;
    display: none;
    .xhcd{
      width: 30px;
      position: absolute;
      bottom: 107px;
      right: 30px;
      z-index: 90;
    }
    .dhcd{
      width: 160px;
      position: absolute;
      bottom: 36px;
      right: 24px;
      z-index: 90;
    }
  }

  .bly {
    position: absolute;
    width: 95%;
    bottom: -10px;
    z-index: 1;
  }

  .bry {
    position: absolute;
    width: 100%;
    right: 0;
    bottom: -10px;
    z-index: 50;
  }
}
</style>
